<?php

use think\migration\Seeder;

class Menu extends Seeder
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run()
    {
        $data = [
            [
                'title' => '仪表盘',
                'icon'  => 'fa-home',
                'path'  => 'index/index',
                'pid'   => 0,
                'sort'  => -1,
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
            ],
            [
                'title' => '系统管理',
                'icon'  => 'fa-tasks',
                'pid'   => 0,
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
                'sort' => 99,
                'role' => 1
            ],
            [
                'title' => '用户管理',
                'icon'  => 'fa-users',
                'path'  => 'user/index',
                'pid'   => 2,
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
                'role' => 1
            ],
            [
                'title' => '角色管理',
                'icon'  => 'fa-user',
                'path'  => 'role/index',
                'pid'   => 2,
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
                'role' => 1
            ],
            [
                'title' => '菜单管理',
                'icon'  => 'fa-bars',
                'path'  => 'menu/index',
                'pid'   => 2,
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
                'role' => 1
            ],
            [
                'title' => '权限',
                'icon'  => 'fa-ban',
                'path'  => 'permission/index',
                'pid'   => 2,
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
                'role' => 1
            ],
            [
                'title' => '微信管理',
                'icon'  => 'fa-wechat',
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
                'role' => 1
            ],
            [
                'title' => '公众号',
                'path'  => 'wechat/index',
                'pid'   => 7,
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
                'role' => 1
            ],
            [
                'title' => '微信用户',
                'path'  => 'wuser/index',
                'pid'   => 7,
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
                'role' => 1
            ],
            [
                'title' => '模板消息',
                'path'  => 'tmsg/index',
                'pid'   => 7,
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
                'role' => 1
            ],
            [
                'title' => '微信消息',
                'icon'  => 'fa-commenting',
                'path'  => 'wmsg/index',
                'pid'   => 7,
                'add_time'    => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s'),
                'role' => 1
            ],
        ];

        $menu = $this->table('menu');
        $menu->insert($data)->save();
    }
}